package com.ct.controller.shipping;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ct.application.shipping.model.po.ChuanYuanDiaoLingSavePO;
import com.ct.application.shipping.model.po.ChuanYuanDiaoLingSearchPO;
import com.ct.application.shipping.model.po.LiuChengYeWuSavePO;
import com.ct.application.shipping.model.vo.ChuanYuanDiaoLingVO;
import com.ct.application.shipping.service.ChuanYuanDiaoLingService;
import com.ct.commons.BaseController;
import com.ct.commons.annotation.ApiLog;
import com.ct.commons.annotation.HasAdmin;
import com.ct.commons.annotation.PermissionApi;
import com.ct.commons.aspect.limiter.AccessIpLimiter;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 船员调令配置
 * @author Auto Generator
 * @since 2023-08-16
 */
@RestController
@PermissionApi(title = "船员调令",path="/api/v1/chuanyuandiaoling",code = "H1000",sorted = 7)
public class ChuanYuanDiaoLingController extends BaseController {

    @Resource
    private ChuanYuanDiaoLingService chuanYuanDiaoLingService;

    /**
     * 查询船员调令列表
     */
    @PostMapping("/chuanyuandiaoling/list")
    @PermissionApi(title = "查询船员调令列表",path="/api/v1/chuanyuandiaoling/list",code = "H1001",sorted = 1)
    public Page<ChuanYuanDiaoLingVO> findChuanYuanDiaoLings(@Validated @RequestBody ChuanYuanDiaoLingSearchPO chuanYuanFenZuSearchPO) {
        return chuanYuanDiaoLingService.findChuanYuanDiaoLing(chuanYuanFenZuSearchPO);
    }

    /**
     * 保存和更新
     */
    @PostMapping("/chuanyuandiaoling/saveupdate")
    @ApiLog("船员调令保存和更新")
    @HasAdmin
    @AccessIpLimiter
    @PermissionApi(title = "船员调令保存和更新",path="/api/v1/chuanyuandiaoling/saveupdate",code = "H1003",sorted = 3)
    public Boolean saveUpdateChuanYuanDiaoLing(@Validated @RequestBody ChuanYuanDiaoLingSavePO savePO) {
            return chuanYuanDiaoLingService.saveChuanYuanDiaoLing(savePO);
    }

    /**
     * 根据id查询船员调令
     */
    @PostMapping("/chuanyuandiaoling/get/{id}")
    @PermissionApi(title = "根据id查询船员调令",path="/api/v1/chuanyuandiaoling/get/{id}",code = "H1004",sorted = 4)
    public ChuanYuanDiaoLingVO getChuanYuanDiaoLingById(@PathVariable("id") Long id) {
        return chuanYuanDiaoLingService.getChuanYuanDiaoLing(id);
    }

    /**
     * 审批
     */
    @PostMapping("/chuanyuandiaoling/shenpi")
    @ApiLog("船员调令审批操作")
    @AccessIpLimiter
    @PermissionApi(title = "船员调令审批操作",path="/api/v1/chuanyuandiaoling/shenpi",code = "H1007",sorted = 3)
    public Boolean shenpi(@Validated @RequestBody LiuChengYeWuSavePO savePO) {
        return chuanYuanDiaoLingService.shenPi(savePO);
    }

}



